import axios from "axios";

export const actions_getProducts=data=>{
    return {
        type:"GETPRODUCTS",
        payload:data
    } 
}

export function fetchProductsList(page){    
    var page=page || 1 ;
    return (dispatch)=>{
        var url="http://10.31.160.78:3000/product/list";
        return   axios.get(url+"?page="+page)
        .then( (res)=>{
            // console.log(res.data);  //请求到的数据
            dispatch(actions_getProducts(res.data));
        });
    }
}